/**
 * 
 */
package com.dp.creat.builder;

/**
 * This describes builder design pattern
 * 
 * It is used to construct a complex object step by step and the final step will
 * return the object. The process of constructing an object should be generic so
 * that it can be used for different representations
 * 
 * @author Sunaina.Sharma
 * 
 */
public class BuilderEx {

	/**
	 * @param builder
	 */
	BuilderEx(HouseBuilder builder) {
		houseBuilder = builder;
	}

	private HouseBuilder houseBuilder;

	/**
	 * @return
	 */
	public House getHouse() {
		return this.houseBuilder.getHouse();
	}

	/**
	 * 
	 */
	public void constructHouse() {
		this.houseBuilder.constructBasement();
		this.houseBuilder.constructFloor();
		this.houseBuilder.constructRoof();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BuilderEx builderEx = new BuilderEx(new IglooHouseBuilder());
		builderEx.constructHouse();
		House house = builderEx.getHouse();
		System.out.println("house::" + house.getBasement());
	}

}
